package com.example.demo.controller;

import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.Map;

public class ApiUtil {



  public static void main(String[] args) throws Exception {
    String result = getPageData("1","10","http://yczwfw.yichang.gov.cn:8010");
    JSONObject aa = JSONObject.parseObject(result);
    System.out.println(aa);//如图2
  }

    public static String getPageData(String page,String pageSize,String apiAddress) throws Exception {
    //正式环境地址(一般调用接口使用以下地址)
    String userId = "zmqzwzx";//调用接口账号
    String apiKey = "4BFF49B947F8EF78E36ADA6C21721DD4";//调用接口APIKEY,请妥善保管
    HbzzApi api = HbzzApi.createInstance(apiAddress, userId, apiKey);
    Map<String, String> param = new HashMap<>();
    param.put("page", page);
    param.put("limit", pageSize);
//没有参数则传递一个实例map即可
    return new String(api.GetApi("/ythptflow/api/business/businessIndexRegion/getBizIndexPageList_420550", HbzzApi.HttpMethod.POST, param),
        "UTF-8");
  }

}
